package com.langfeiyes.pattern.observer.demo3;

public class App {


    public static void main(String[] args) {
        //Observable //可观察者(目标对象)
        //Observer  观察者

        //目标对象
       ProductObserver ob = new ProductObserver("Iphone20");

        //观察者
        ConsumerObserver xm = new ConsumerObserver("小明");
        ConsumerObserver xh = new ConsumerObserver("小红");

        //小明小红订阅：到货通知
        ob.addObserver(xm);
        ob.addObserver(xh);

        //商品进货
        ob.stock(100);
    }
}
